package cn.lagou.Homework.RockPaperScissor

class User(override val name: String) extends Player {
  override var score: Int = 0

  override def showFist(): String = {
    var fistNum = -1
    println("请出拳！1.石头 2.剪刀 3.布")
    try {
      fistNum = scala.io.StdIn.readInt()
    } catch {
      case e: Exception => e.printStackTrace()
    }
    val result = fistNum match {
      case 1 => "石头"
      case 2 => "剪刀"
      case _ => "布"
    }
    if (fistNum > 3 || fistNum < 1) println("输入不符合规范，默认出布")
    else println(s"你出拳:${result}")
    result
  }
}
